3.5.38 \(\int \sec (c+d x) (a+b \tan ^2(c+d x))^2 \, dx\) [438]

3.5.38.1 Optimal result
3.5.38.2 Mathematica [C] (warning: unable to verify)
3.5.38.3 Rubi [A] (verified)
3.5.38.4 Maple [A] (verified)
3.5.38.5 Fricas [A] (verification not implemented)
3.5.38.6 Sympy [F]
3.5.38.7 Maxima [A] (verification not implemented)
3.5.38.8 Giac [A] (verification not implemented)
3.5.38.9 Mupad [B] (verification not implemented)

3.5.38.1 Optimal result

Integrand size = 21, antiderivative size = 96 \[ \int \sec (c+d x) \left (a+b \tan ^2(c+d x)\right )^2 \, dx=\frac {\left (8 a^2-8 a b+3 b^2\right ) \text {arctanh}(\sin (c+d x))}{8 d}+\frac {3 (2 a-b) b \sec (c+d x) \tan (c+d x)}{8 d}+\frac {b \sec ^3(c+d x) \left (a-(a-b) \sin ^2(c+d x)\right ) \tan (c+d x)}{4 d} \]

output
1/8*(8*a^2-8*a*b+3*b^2)*arctanh(sin(d*x+c))/d+3/8*(2*a-b)*b*sec(d*x+c)*tan 
(d*x+c)/d+1/4*b*sec(d*x+c)^3*(a-(a-b)*sin(d*x+c)^2)*tan(d*x+c)/d
 
3.5.38.2 Mathematica [C] (warning: unable to verify)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 7.35 (sec) , antiderivative size = 420, normalized size of antiderivative = 4.38 \[ \int \sec (c+d x) \left (a+b \tan ^2(c+d x)\right )^2 \, dx=\frac {\csc ^3(c+d x) \left (128 \, _5F_4\left (\frac {3}{2},2,2,2,2;1,1,1,\frac {9}{2};\sin ^2(c+d x)\right ) \sin ^6(c+d x) \left (a-a \sin ^2(c+d x)+b \sin ^2(c+d x)\right )^2+128 \, _4F_3\left (\frac {3}{2},2,2,2;1,1,\frac {9}{2};\sin ^2(c+d x)\right ) \sin ^6(c+d x) \left (5 b^2 \sin ^4(c+d x)-2 a b \sin ^2(c+d x) \left (-6+5 \sin ^2(c+d x)\right )+a^2 \left (7-12 \sin ^2(c+d x)+5 \sin ^4(c+d x)\right )\right )+35 \left (b^2 \sin ^4(c+d x) \left (-1947+485 \sin ^2(c+d x)\right )-2 a b \sin ^2(c+d x) \left (2625-2554 \sin ^2(c+d x)+485 \sin ^4(c+d x)\right )+a^2 \left (-3375+5907 \sin ^2(c+d x)-3161 \sin ^4(c+d x)+485 \sin ^6(c+d x)\right )+\frac {3 \text {arctanh}\left (\sqrt {\sin ^2(c+d x)}\right ) \left (b^2 \sin ^4(c+d x) \left (649-378 \sin ^2(c+d x)+9 \sin ^4(c+d x)\right )-2 a b \sin ^2(c+d x) \left (-875+1143 \sin ^2(c+d x)-389 \sin ^4(c+d x)+9 \sin ^6(c+d x)\right )+a^2 \left (1125-2344 \sin ^2(c+d x)+1674 \sin ^4(c+d x)-400 \sin ^6(c+d x)+9 \sin ^8(c+d x)\right )\right )}{\sqrt {\sin ^2(c+d x)}}\right )\right )}{6720 d} \]

input
Integrate[Sec[c + d*x]*(a + b*Tan[c + d*x]^2)^2,x]
 
output
(Csc[c + d*x]^3*(128*HypergeometricPFQ[{3/2, 2, 2, 2, 2}, {1, 1, 1, 9/2}, 
Sin[c + d*x]^2]*Sin[c + d*x]^6*(a - a*Sin[c + d*x]^2 + b*Sin[c + d*x]^2)^2 
 + 128*HypergeometricPFQ[{3/2, 2, 2, 2}, {1, 1, 9/2}, Sin[c + d*x]^2]*Sin[ 
c + d*x]^6*(5*b^2*Sin[c + d*x]^4 - 2*a*b*Sin[c + d*x]^2*(-6 + 5*Sin[c + d* 
x]^2) + a^2*(7 - 12*Sin[c + d*x]^2 + 5*Sin[c + d*x]^4)) + 35*(b^2*Sin[c + 
d*x]^4*(-1947 + 485*Sin[c + d*x]^2) - 2*a*b*Sin[c + d*x]^2*(2625 - 2554*Si 
n[c + d*x]^2 + 485*Sin[c + d*x]^4) + a^2*(-3375 + 5907*Sin[c + d*x]^2 - 31 
61*Sin[c + d*x]^4 + 485*Sin[c + d*x]^6) + (3*ArcTanh[Sqrt[Sin[c + d*x]^2]] 
*(b^2*Sin[c + d*x]^4*(649 - 378*Sin[c + d*x]^2 + 9*Sin[c + d*x]^4) - 2*a*b 
*Sin[c + d*x]^2*(-875 + 1143*Sin[c + d*x]^2 - 389*Sin[c + d*x]^4 + 9*Sin[c 
 + d*x]^6) + a^2*(1125 - 2344*Sin[c + d*x]^2 + 1674*Sin[c + d*x]^4 - 400*S 
in[c + d*x]^6 + 9*Sin[c + d*x]^8)))/Sqrt[Sin[c + d*x]^2])))/(6720*d)
 
3.5.38.3 Rubi [A] (verified)

Time = 0.28 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.15, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3042, 4159, 315, 25, 298, 219}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \sec (c+d x) \left (a+b \tan ^2(c+d x)\right )^2 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \sec (c+d x) \left (a+b \tan (c+d x)^2\right )^2dx\)

\(\Big \downarrow \) 4159

\(\displaystyle \frac {\int \frac {\left (a-(a-b) \sin ^2(c+d x)\right )^2}{\left (1-\sin ^2(c+d x)\right )^3}d\sin (c+d x)}{d}\)

\(\Big \downarrow \) 315

\(\displaystyle \frac {\frac {b \sin (c+d x) \left (a-(a-b) \sin ^2(c+d x)\right )}{4 \left (1-\sin ^2(c+d x)\right )^2}-\frac {1}{4} \int -\frac {a (4 a-b)-(4 a-3 b) (a-b) \sin ^2(c+d x)}{\left (1-\sin ^2(c+d x)\right )^2}d\sin (c+d x)}{d}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {\frac {1}{4} \int \frac {a (4 a-b)-(4 a-3 b) (a-b) \sin ^2(c+d x)}{\left (1-\sin ^2(c+d x)\right )^2}d\sin (c+d x)+\frac {b \sin (c+d x) \left (a-(a-b) \sin ^2(c+d x)\right )}{4 \left (1-\sin ^2(c+d x)\right )^2}}{d}\)

\(\Big \downarrow \) 298

\(\displaystyle \frac {\frac {1}{4} \left (\frac {1}{2} \left (8 a^2-8 a b+3 b^2\right ) \int \frac {1}{1-\sin ^2(c+d x)}d\sin (c+d x)+\frac {3 b (2 a-b) \sin (c+d x)}{2 \left (1-\sin ^2(c+d x)\right )}\right )+\frac {b \sin (c+d x) \left (a-(a-b) \sin ^2(c+d x)\right )}{4 \left (1-\sin ^2(c+d x)\right )^2}}{d}\)

\(\Big \downarrow \) 219

\(\displaystyle \frac {\frac {1}{4} \left (\frac {1}{2} \left (8 a^2-8 a b+3 b^2\right ) \text {arctanh}(\sin (c+d x))+\frac {3 b (2 a-b) \sin (c+d x)}{2 \left (1-\sin ^2(c+d x)\right )}\right )+\frac {b \sin (c+d x) \left (a-(a-b) \sin ^2(c+d x)\right )}{4 \left (1-\sin ^2(c+d x)\right )^2}}{d}\)

input
Int[Sec[c + d*x]*(a + b*Tan[c + d*x]^2)^2,x]
 
output
((b*Sin[c + d*x]*(a - (a - b)*Sin[c + d*x]^2))/(4*(1 - Sin[c + d*x]^2)^2) 
+ (((8*a^2 - 8*a*b + 3*b^2)*ArcTanh[Sin[c + d*x]])/2 + (3*(2*a - b)*b*Sin[ 
c + d*x])/(2*(1 - Sin[c + d*x]^2)))/4)/d
 

3.5.38.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 219
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* 
ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt 
Q[a, 0] || LtQ[b, 0])
 

rule 298
Int[((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2), x_Symbol] :> Simp[(-( 
b*c - a*d))*x*((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] - Simp[(a*d - b*c*( 
2*p + 3))/(2*a*b*(p + 1))   Int[(a + b*x^2)^(p + 1), x], x] /; FreeQ[{a, b, 
 c, d, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/2 + p, 0])
 

rule 315
Int[((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^(q_), x_Symbol] :> Sim 
p[(a*d - c*b)*x*(a + b*x^2)^(p + 1)*((c + d*x^2)^(q - 1)/(2*a*b*(p + 1))), 
x] - Simp[1/(2*a*b*(p + 1))   Int[(a + b*x^2)^(p + 1)*(c + d*x^2)^(q - 2)*S 
imp[c*(a*d - c*b*(2*p + 3)) + d*(a*d*(2*(q - 1) + 1) - b*c*(2*(p + q) + 1)) 
*x^2, x], x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && LtQ[p, - 
1] && GtQ[q, 1] && IntBinomialQ[a, b, c, d, 2, p, q, x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4159
Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^(n_ 
))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Sin[e + f*x], x]}, Simp[ff/f 
  Subst[Int[ExpandToSum[b*(ff*x)^n + a*(1 - ff^2*x^2)^(n/2), x]^p/(1 - ff^2 
*x^2)^((m + n*p + 1)/2), x], x, Sin[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f} 
, x] && IntegerQ[(m - 1)/2] && IntegerQ[n/2] && IntegerQ[p]
 
3.5.38.4 Maple [A] (verified)

Time = 0.45 (sec) , antiderivative size = 146, normalized size of antiderivative = 1.52

method result size
derivativedivides \(\frac {b^{2} \left (\frac {\sin \left (d x +c \right )^{5}}{4 \cos \left (d x +c \right )^{4}}-\frac {\sin \left (d x +c \right )^{5}}{8 \cos \left (d x +c \right )^{2}}-\frac {\sin \left (d x +c \right )^{3}}{8}-\frac {3 \sin \left (d x +c \right )}{8}+\frac {3 \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{8}\right )+2 a b \left (\frac {\sin \left (d x +c \right )^{3}}{2 \cos \left (d x +c \right )^{2}}+\frac {\sin \left (d x +c \right )}{2}-\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(146\)
default \(\frac {b^{2} \left (\frac {\sin \left (d x +c \right )^{5}}{4 \cos \left (d x +c \right )^{4}}-\frac {\sin \left (d x +c \right )^{5}}{8 \cos \left (d x +c \right )^{2}}-\frac {\sin \left (d x +c \right )^{3}}{8}-\frac {3 \sin \left (d x +c \right )}{8}+\frac {3 \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{8}\right )+2 a b \left (\frac {\sin \left (d x +c \right )^{3}}{2 \cos \left (d x +c \right )^{2}}+\frac {\sin \left (d x +c \right )}{2}-\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(146\)
risch \(\frac {i b \,{\mathrm e}^{i \left (d x +c \right )} \left (-8 a \,{\mathrm e}^{6 i \left (d x +c \right )}+5 b \,{\mathrm e}^{6 i \left (d x +c \right )}-8 a \,{\mathrm e}^{4 i \left (d x +c \right )}-3 b \,{\mathrm e}^{4 i \left (d x +c \right )}+8 a \,{\mathrm e}^{2 i \left (d x +c \right )}+3 b \,{\mathrm e}^{2 i \left (d x +c \right )}+8 a -5 b \right )}{4 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{4}}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a^{2}}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a b}{d}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b^{2}}{8 d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a^{2}}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a b}{d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b^{2}}{8 d}\) \(246\)

input
int(sec(d*x+c)*(a+b*tan(d*x+c)^2)^2,x,method=_RETURNVERBOSE)
 
output
1/d*(b^2*(1/4*sin(d*x+c)^5/cos(d*x+c)^4-1/8*sin(d*x+c)^5/cos(d*x+c)^2-1/8* 
sin(d*x+c)^3-3/8*sin(d*x+c)+3/8*ln(sec(d*x+c)+tan(d*x+c)))+2*a*b*(1/2*sin( 
d*x+c)^3/cos(d*x+c)^2+1/2*sin(d*x+c)-1/2*ln(sec(d*x+c)+tan(d*x+c)))+a^2*ln 
(sec(d*x+c)+tan(d*x+c)))
 
3.5.38.5 Fricas [A] (verification not implemented)

Time = 0.29 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.21 \[ \int \sec (c+d x) \left (a+b \tan ^2(c+d x)\right )^2 \, dx=\frac {{\left (8 \, a^{2} - 8 \, a b + 3 \, b^{2}\right )} \cos \left (d x + c\right )^{4} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (8 \, a^{2} - 8 \, a b + 3 \, b^{2}\right )} \cos \left (d x + c\right )^{4} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left ({\left (8 \, a b - 5 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, b^{2}\right )} \sin \left (d x + c\right )}{16 \, d \cos \left (d x + c\right )^{4}} \]

input
integrate(sec(d*x+c)*(a+b*tan(d*x+c)^2)^2,x, algorithm="fricas")
 
output
1/16*((8*a^2 - 8*a*b + 3*b^2)*cos(d*x + c)^4*log(sin(d*x + c) + 1) - (8*a^ 
2 - 8*a*b + 3*b^2)*cos(d*x + c)^4*log(-sin(d*x + c) + 1) + 2*((8*a*b - 5*b 
^2)*cos(d*x + c)^2 + 2*b^2)*sin(d*x + c))/(d*cos(d*x + c)^4)
 
3.5.38.6 Sympy [F]

\[ \int \sec (c+d x) \left (a+b \tan ^2(c+d x)\right )^2 \, dx=\int \left (a + b \tan ^{2}{\left (c + d x \right )}\right )^{2} \sec {\left (c + d x \right )}\, dx \]

input
integrate(sec(d*x+c)*(a+b*tan(d*x+c)**2)**2,x)
 
output
Integral((a + b*tan(c + d*x)**2)**2*sec(c + d*x), x)
 
3.5.38.7 Maxima [A] (verification not implemented)

Time = 0.25 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.24 \[ \int \sec (c+d x) \left (a+b \tan ^2(c+d x)\right )^2 \, dx=\frac {{\left (8 \, a^{2} - 8 \, a b + 3 \, b^{2}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (8 \, a^{2} - 8 \, a b + 3 \, b^{2}\right )} \log \left (\sin \left (d x + c\right ) - 1\right ) - \frac {2 \, {\left ({\left (8 \, a b - 5 \, b^{2}\right )} \sin \left (d x + c\right )^{3} - {\left (8 \, a b - 3 \, b^{2}\right )} \sin \left (d x + c\right )\right )}}{\sin \left (d x + c\right )^{4} - 2 \, \sin \left (d x + c\right )^{2} + 1}}{16 \, d} \]

input
integrate(sec(d*x+c)*(a+b*tan(d*x+c)^2)^2,x, algorithm="maxima")
 
output
1/16*((8*a^2 - 8*a*b + 3*b^2)*log(sin(d*x + c) + 1) - (8*a^2 - 8*a*b + 3*b 
^2)*log(sin(d*x + c) - 1) - 2*((8*a*b - 5*b^2)*sin(d*x + c)^3 - (8*a*b - 3 
*b^2)*sin(d*x + c))/(sin(d*x + c)^4 - 2*sin(d*x + c)^2 + 1))/d
 
3.5.38.8 Giac [A] (verification not implemented)

Time = 0.64 (sec) , antiderivative size = 120, normalized size of antiderivative = 1.25 \[ \int \sec (c+d x) \left (a+b \tan ^2(c+d x)\right )^2 \, dx=\frac {{\left (8 \, a^{2} - 8 \, a b + 3 \, b^{2}\right )} \log \left ({\left | \sin \left (d x + c\right ) + 1 \right |}\right ) - {\left (8 \, a^{2} - 8 \, a b + 3 \, b^{2}\right )} \log \left ({\left | \sin \left (d x + c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (8 \, a b \sin \left (d x + c\right )^{3} - 5 \, b^{2} \sin \left (d x + c\right )^{3} - 8 \, a b \sin \left (d x + c\right ) + 3 \, b^{2} \sin \left (d x + c\right )\right )}}{{\left (\sin \left (d x + c\right )^{2} - 1\right )}^{2}}}{16 \, d} \]

input
integrate(sec(d*x+c)*(a+b*tan(d*x+c)^2)^2,x, algorithm="giac")
 
output
1/16*((8*a^2 - 8*a*b + 3*b^2)*log(abs(sin(d*x + c) + 1)) - (8*a^2 - 8*a*b 
+ 3*b^2)*log(abs(sin(d*x + c) - 1)) - 2*(8*a*b*sin(d*x + c)^3 - 5*b^2*sin( 
d*x + c)^3 - 8*a*b*sin(d*x + c) + 3*b^2*sin(d*x + c))/(sin(d*x + c)^2 - 1) 
^2)/d
 
3.5.38.9 Mupad [B] (verification not implemented)

Time = 15.03 (sec) , antiderivative size = 177, normalized size of antiderivative = 1.84 \[ \int \sec (c+d x) \left (a+b \tan ^2(c+d x)\right )^2 \, dx=\frac {\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (2\,a^2-2\,a\,b+\frac {3\,b^2}{4}\right )}{d}+\frac {\left (2\,a\,b-\frac {3\,b^2}{4}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+\left (\frac {11\,b^2}{4}-2\,a\,b\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (\frac {11\,b^2}{4}-2\,a\,b\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (2\,a\,b-\frac {3\,b^2}{4}\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8-4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+6\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )} \]

input
int((a + b*tan(c + d*x)^2)^2/cos(c + d*x),x)
 
output
(atanh(tan(c/2 + (d*x)/2))*(2*a^2 - 2*a*b + (3*b^2)/4))/d + (tan(c/2 + (d* 
x)/2)^7*(2*a*b - (3*b^2)/4) - tan(c/2 + (d*x)/2)^3*(2*a*b - (11*b^2)/4) - 
tan(c/2 + (d*x)/2)^5*(2*a*b - (11*b^2)/4) + tan(c/2 + (d*x)/2)*(2*a*b - (3 
*b^2)/4))/(d*(6*tan(c/2 + (d*x)/2)^4 - 4*tan(c/2 + (d*x)/2)^2 - 4*tan(c/2 
+ (d*x)/2)^6 + tan(c/2 + (d*x)/2)^8 + 1))